<template>
  <div class="search">
    <f-form ref="form" :action="api.appointment" :form-key="this.formItem.appointmentId" >
      <f-form-item label="物品Id"  name="accountGoodsId" dataType="${formField.dataType}"   :value="formItem.accountGoodsId" />
      <f-form-item label="预约"  name="appointType" dataType="number"   :value="formItem.appointType" />
      <f-form-item label="贵宾厅/贵宾通道Id"  name="targetId" dataType="${formField.dataType}"   :value="formItem.targetId" />
      <f-form-item label=""  name="vipCardNo" dataType="${formField.dataType}"   :value="formItem.vipCardNo" />
      <f-form-item label="航班号"  name="flightNumber" dataType="${formField.dataType}"   :value="formItem.flightNumber" />
      <f-form-item label="起飞时间"  name="takeOffTime" dataType="${formField.dataType}"   :value="formItem.takeOffTime" />
      <f-form-item label="始发地"  name="originatingPlace" dataType="${formField.dataType}"   :value="formItem.originatingPlace" />
      <f-form-item label="到达地"  name="destinationPlace" dataType="${formField.dataType}"   :value="formItem.destinationPlace" />
      <f-form-item label="姓名"  name="userName" dataType="${formField.dataType}"   :value="formItem.userName" />
      <f-form-item label="航班日期"  name="flightDate" dataType="${formField.dataType}"   :value="formItem.flightDate" />
      <f-form-item label="证件类型（1身份证，2护照,3港澳通行证，4台胞证）"  name="identityType" dataType="number"   :value="formItem.identityType" />
      <f-form-item label="证件号"  name="identityNo" dataType="${formField.dataType}"   :value="formItem.identityNo" />
      <f-form-item label="电话"  name="phone" dataType="${formField.dataType}"   :value="formItem.phone" />
      <f-form-item label="预约操作者"  name="accountId" dataType="${formField.dataType}"   :value="formItem.accountId" />
      <f-form-item label=""  name="orderdetailId" dataType="${formField.dataType}"   :value="formItem.orderdetailId" />
      <f-form-item label=""  name="appointmentState" dataType="number"   :value="formItem.appointmentState" />
      <f-form-item label=""  name="remindWay" dataType="number"   :value="formItem.remindWay" />
      <f-form-item label=""  name="soureType" dataType="number"   :value="formItem.soureType" />
      <f-form-item label=""  name="useCode" dataType="${formField.dataType}"   :value="formItem.useCode" />
      <f-form-item label=""  name="appointmentUseNum" dataType="number"   :value="formItem.appointmentUseNum" />
      <f-form-item label=""  name="createDate" dataType="${formField.dataType}"   :value="formItem.createDate" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'appointmentForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          appointmentId: '',
          accountGoodsId: '',
          appointType: '',
          targetId: '',
          vipCardNo: '',
          flightNumber: '',
          takeOffTime: '',
          originatingPlace: '',
          destinationPlace: '',
          userName: '',
          flightDate: '',
          identityType: '',
          identityNo: '',
          phone: '',
          accountId: '',
          orderdetailId: '',
          appointmentState: '',
          remindWay: '',
          soureType: '',
          useCode: '',
          appointmentUseNum: '',
          createDate: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.appointmentId) {
          let params={
              appointmentId:data.appointmentId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
